package com.zx.map.dao;

import com.zx.map.dao.model.OrdLog;
import com.zx.map.dao.model.OrdLogExample;

import org.apache.ibatis.annotations.Param;
import org.springframework.dao.DataAccessException;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public interface OrdLogDao {

    /**
     * 新增
     *
     * @param ordLog
     * @return
     * @throws DataAccessException
     */
    public String add(OrdLog ordLog) throws DataAccessException;

    /**
     * 更新
     *
     * @param ordLog
     * @return
     * @throws DataAccessException
     */
    public String update(OrdLog ordLog) throws DataAccessException;

    /**
     * 删除
     *
     * @param ordLog
     * @throws DataAccessException
     */
    public void delete(OrdLog ordLog) throws DataAccessException;

    /**
     * 分页查询
     *
     * @param pageSize
     * @param pageBegin
     * @param example
     * @return
     * @throws DataAccessException
     */
    public List<OrdLog> getPageByExample(int pageSize, int pageBegin,
                                         OrdLogExample example) throws DataAccessException;

    /**
     * 根据Model查找List
     *
     * @param example
     * @return
     * @throws DataAccessException
     */
    public List<OrdLog> getListByExample(OrdLogExample example) throws DataAccessException;

    /**
     * 查找条数
     *
     * @param example
     * @return
     * @throws DataAccessException
     */
    public int countByExample(OrdLogExample example) throws DataAccessException;

    /**
     * 根据单Key查找Model
     *
     * @param key
     * @return
     * @throws DataAccessException
     */
    public OrdLog selectByPrimaryKey(String key) throws DataAccessException;

    /**
     * 根据单Key查找Model并加行锁
     *
     * @param key
     * @return
     * @throws DataAccessException
     */
    public OrdLog selectByPrimaryKeyAndLineLock(String key) throws DataAccessException;


    /**
     * 计算收款金额，
     *
     * @return
     * @throws DataAccessException
     */
    public Double geGatheringAmt() throws DataAccessException;

    /**
     * 计算结算金额
     *
     * @return
     * @throws DataAccessException
     */
    public Double geBackAccountAmt() throws DataAccessException;


    /**
     * 余额
     *
     * @return
     * @throws DataAccessException
     */
    public Double geSettleAmt() throws DataAccessException;


    /**
     * T0额度
     *
     * @return
     * @throws DataAccessException
     */
    public Double geT0Amt() throws DataAccessException;

    /**
     * 计算笔数
     *
     * @return
     * @throws DataAccessException
     */
    public Integer geSettleCount() throws DataAccessException;

    /**
     * 收款笔数
     *
     * @return
     * @throws DataAccessException
     */
    public Integer geGatheringCount() throws DataAccessException;

    /**
     * 计算收款金额，
     *
     * @return
     * @throws DataAccessException
     */
    public Integer geGatheringCountByAgent(List values) throws DataAccessException;
    /**
     * 计算收款金额，
     *
     * @return
     * @throws DataAccessException
     */
    public Double geGatheringAmtByAgent(List values) throws DataAccessException;
    /**
     * 订单总额
     * @return
     * @throws DataAccessException
     */
    public Double getPaymentAmt(OrdLogExample example) throws DataAccessException;
    /**
     * 运营分析
     * @param pageSize
     * @param pageBegin
     * @param example
     * @return
     */
    public List<Map<String,Object>> orderAnalysis(OrdLogExample example) throws DataAccessException;
	/**
	 * 获取该商户的新增用户（交易成功的用户）
	 * @param merchantId
	 * @param createDate
	 * @param transStatus
	 * @return
	 */
	public int countTodayNewMembers(String merchantId, String createDate, String endDate, String transStatus) throws DataAccessException;
    /**
     * 获取当日的所有会员数量
     * @param example
     * @return
     */
	public int countTodayAllMembers(OrdLogExample example) throws DataAccessException;
	/**
	 * 运营数据分析
	 * @param params
	 * @return
	 * @throws DataAccessException
	 */
	public List<Map<String, Object>> groupbyType(OrdLogExample example, String analysisType, String groupbyType)  throws DataAccessException;
	/**
	 * 获取用户
	 * @param example
	 * @return
	 * @throws DataAccessException
	 */
	public long getUsers(OrdLogExample example)   throws DataAccessException;
}
